package com.graduate.cec.controller;

import com.graduate.cec.common.JsonResult;
import com.graduate.cec.pojo.entity.Love;
import com.graduate.cec.service.LoveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping(value = "/love",produces = "application/json;charset=utf-8")
@Api(tags = "点赞管理")
public class LoveController {
    @Resource
    private LoveService loveService;
    /****************        增       ******************************************************************/
    @GetMapping("/insert-love")
    @ApiOperation("增加分类")
    public JsonResult<Void> insertLove(Love love){
        log.info("love:{}",love);
        return JsonResult.ok("插入成功");
    }



    /****************        删       ******************************************************************/
    @DeleteMapping("/delete-by-keys/{ids}")
    @ApiOperation("通过主键删除分类")
    public JsonResult<Void> deleteByKeys(@PathVariable Long ids){
        log.info("ids:{}", ids);
        loveService.deleteByKeys(ids);
        return JsonResult.ok("删除成功");
    }


    /****************        改       ******************************************************************/



    /****************        查        ******************************************************************/


    /**
     * 查询所有列表
     * @return JsonResult<List<LoveVO>>
     */
    @GetMapping("/get-count")
    @ApiOperation("查询全部列表")
    public JsonResult<List<Love>> getCount(Love love){
        return JsonResult.ok("查询成功",loveService.getCount(love));
    }



}
